package org.callisto.handlers;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Observable;

import org.callisto.model.Event;
import org.callisto.model.Keyboard;

public class FileOutputHandler extends KeyboardObserver {

	public FileOutputHandler(Keyboard keyboard) {
		super(keyboard);
	}

	public void update(Observable o, Object arg) {
		try {
			BufferedWriter writer = new BufferedWriter(new FileWriter("data/midiData.txt"));
			writer.write(arg + "\n");
			writer.flush();
			writer.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	@Override
	public void handleEvent(Event event) {
	}
}
